Connecting to Microsoft SQL Server in Tableau
Course: Tableau Training
Topic: Connecting to Microsoft SQL Server
Course Link: JustAcademy Tableau Training
Demo Link: Register for a Tableau Course Demo
1. Introduction to Microsoft SQL Server
Microsoft SQL Server is a relational database management system (RDBMS) developed by Microsoft. It stores structured data in databases, tables, rows, and columns. Organizations use SQL Server to manage information such as customer records, sales transactions, product details, orders, inventory, and financial data.
Tableau can connect directly to Microsoft SQL Server so users can analyze database information and create charts, reports, and interactive dashboards without manually exporting all the data to Excel or CSV files.
Example
A retail company stores its orders in a SQL Server database. A Tableau analyst connects to the database, selects the Orders table, and creates visualizations to compare sales by region, monitor monthly revenue, and identify profitable products.
2. What Is a Tableau-SQL Server Connection?
A Tableau-SQL Server connection is a link between Tableau and a Microsoft SQL Server database. It allows Tableau to access authorized database tables or queries for analysis.
To establish the connection, you generally need the server name, authentication details, and sometimes a database name, port, or other connection settings.
Key Components
| Component |
Description |
| Tableau |
The data visualization and analytics application. |
| SQL Server |
The database management system that stores the data. |
| Server Name |
The network name or address of the SQL Server instance. |
| Database |
A collection of related database objects. |
| Table |
A structured collection of rows and columns. |
| Authentication |
The method used to verify access to the database. |
| SQL Query |
A command used to retrieve or manipulate database information. |
3. Why Connect Tableau to SQL Server?
- Direct database access: Analyze data stored in SQL Server.
- Large datasets: Work with structured business data that may be too large or inconvenient to manage manually in spreadsheets.
- Interactive dashboards: Create reports with filters, parameters, charts, and other analytical features.
- Current data: Use a live connection when analysis needs to query the underlying source.
- Reusable reporting: Build reports using database tables and approved queries.
- Data combination: Relate or join tables when multiple datasets are needed.
- Business insights: Analyze sales, customers, operations, inventory, and financial performance.
4. Information Required Before Connecting
Before opening Tableau, collect the connection details from your database administrator or IT team.
| Required Information |
Example or Explanation |
| Server Name |
sqlserver.company.local |
| Port Number |
Optional; use the port provided by your administrator if a non-default port is configured. |
| Database Name |
SalesDB |
| Authentication Method |
Windows Authentication or username and password, depending on the environment. |
| Username |
A database account authorized to access the required data, if applicable. |
| Password |
The password for the selected authentication method, if required. |
| Network Access |
Access to the SQL Server through the appropriate network or VPN. |
| SSL/TLS Requirements |
Whether the connection must use encryption. |
| Database Permissions |
Permission to access the relevant database, schema, and tables. |
Important: These are illustrative examples, not actual credentials. Use your organization's server details and never share passwords in public documents or screenshots.
5. Step-by-Step: Connecting to Microsoft SQL Server
- Open Tableau Desktop.
- On the Start Page, locate the Connect section.
- Under To a Server, select Microsoft SQL Server. If it is not listed, select More and locate the connector.
- In the connection dialog, enter the SQL Server name supplied by your administrator.
- Enter a database name if required or if you want to specify a particular database.
- Select the appropriate authentication method.
- Enter the requested credentials or complete the Windows Authentication sign-in process.
- Configure SSL or other connection options according to your organization's requirements.
- Click Sign In or the corresponding connection button.
- After a successful connection, Tableau displays the Data Source page.
- Select the required database, schema, and table.
- Drag the table onto the data model canvas.
- Open a worksheet tab to begin analyzing the data.
Result: Tableau connects to SQL Server and can use the selected data for visualization and analysis.
6. Understanding the SQL Server Connection Dialog
The connection dialog collects the details needed to establish communication with the SQL Server database.
| Setting |
Purpose |
| Server |
Identifies the SQL Server instance to connect to. |
| Database |
Optionally specifies the database to use. |
| Authentication |
Determines how Tableau verifies the user's identity. |
| Username and Password |
Credentials used when the selected authentication method requires them. |
| Require SSL |
Enables the applicable encrypted connection option when required by the server. |
| Read Uncommitted Data |
Allows queries to use the read-uncommitted isolation level when this option is available and selected. |
| Initial SQL |
Optionally runs a specified SQL statement when Tableau establishes a connection. |
Available settings can vary by Tableau version, operating system, and SQL Server configuration. Follow your administrator's instructions for authentication and encryption.
7. Selecting a Database, Schema, and Table
After connecting successfully, Tableau displays available database objects that your account is authorized to access.
7.1 Database
A database is a container for related objects such as tables, views, and stored procedures.
Example: SalesDB, CustomerDB, or InventoryDB.
7.2 Schema
A schema organizes database objects within a database. For example, a database may contain schemas named dbo, sales, or reporting.
7.3 Table
A table stores data in rows and columns. For example, an Orders table might contain OrderID, CustomerID, OrderDate, Sales, and Region.
Steps to Select a Table
- Choose the required database from the Database list.
- Locate the appropriate schema and table.
- Drag the table onto the data model canvas.
- Inspect the data preview.
- Verify that the expected columns and records are available.
- Open a worksheet to start creating visualizations.
8. Example SQL Server Database Structure
Consider a database named SalesDB with a table named Orders.
| OrderID |
OrderDate |
Region |
Product |
Sales |
Profit |
| 1001 |
2026-01-05 |
West |
Laptop |
45000 |
8000 |
| 1002 |
2026-01-12 |
East |
Monitor |
18000 |
3200 |
| 1003 |
2026-02-03 |
North |
Keyboard |
5000 |
900 |
| 1004 |
2026-02-18 |
South |
Laptop |
42000 |
7500 |
| 1005 |
2026-03-08 |
West |
Monitor |
20000 |
3800 |
When Tableau connects to the Orders table, these fields become available for analysis. For example, Region can be used as a dimension and Sales or Profit as measures.
9. Understanding Live Connections and Extracts
Tableau can access SQL Server data through a live connection or, when supported and selected, an extract.
9.1 Live Connection
A live connection allows Tableau to query SQL Server when data is required for analysis. The data shown depends on the source, query execution, permissions, and connection performance.
Advantages:
- Can reflect recent changes in the database when queries run.
- Can use SQL Server's query processing capabilities.
- Can be useful when reports need to work with current source data.
Limitations:
- Performance depends on the database, query complexity, and network.
- Frequent or complex queries may increase database workload.
- The database must be reachable and accessible.
9.2 Extract Connection
An extract is a stored snapshot of data that Tableau can use for analysis. It may improve performance for certain workloads and can reduce repeated queries to the source. The extract must be refreshed when newer data needs to be included.
Advantages:
- Can improve performance for some visualizations.
- Can reduce repeated querying of the database.
- Can support scheduled refresh workflows where the Tableau environment is configured for them.
Limitations:
- The data may become outdated until refreshed.
- Extracts require storage and refresh management.
- Refresh permissions and scheduling depend on the Tableau environment.
Live vs Extract
| Feature |
Live Connection |
Extract |
| Data access |
Queries the underlying database |
Uses a saved snapshot |
| Data freshness |
Can reflect recent source changes when queried |
Reflects the data captured at the last refresh |
| Performance |
Depends on source and network performance |
Can be faster for some workloads |
| Database workload |
Queries can add load to SQL Server |
Can reduce repeated queries after extraction |
| Maintenance |
Requires a working connection and suitable access |
May require manual or scheduled refreshes |
10. Using SQL Queries with Tableau
SQL (Structured Query Language) is used to retrieve and manage relational database information. Tableau can select tables directly or, where supported, use Custom SQL to retrieve data from a query.
Example SQL Query
SELECT
OrderID,
OrderDate,
Region,
Product,
Sales,
Profit
FROM dbo.Orders;
This query retrieves selected fields from the Orders table. The schema and table names should match the actual database structure.
Example: Filter Data Using SQL
SELECT
OrderDate,
Region,
Product,
Sales,
Profit
FROM dbo.Orders
WHERE Sales > 10000;
This query returns records where Sales is greater than 10,000.
Using Custom SQL in Tableau
- Connect to Microsoft SQL Server.
- Navigate to the Data Source page.
- Use the Custom SQL option if it is available for the connection.
- Enter a valid query supported by SQL Server.
- Confirm the query and inspect the returned fields.
- Open a worksheet and use the results for analysis.
Best practice: Start with a simple query, retrieve only the fields you need, and test the SQL in an approved database environment. Use read-only access for reporting whenever possible.
11. Working with Multiple SQL Server Tables
Business data is often divided into multiple related tables. Tableau can use relationships and joins to analyze information from different tables.
Example
The Orders table contains OrderID, CustomerID, and Sales. The Customers table contains CustomerID, CustomerName, and City. Connecting the tables using CustomerID allows analysis of sales by customer city.
Relationships
Relationships connect tables through common fields while preserving their logical table structures. Tableau determines how to query related tables based on the visualization.
Joins
Joins combine rows from tables based on matching conditions.
| Join Type |
Description |
| Inner Join |
Returns rows with matching values in both tables. |
| Left Join |
Returns all rows from the left table and matching rows from the right table. |
| Right Join |
Returns all rows from the right table and matching rows from the left table. |
| Full Outer Join |
Returns matching rows and unmatched rows from both tables. |
After combining tables, validate record counts, matching keys, and totals to ensure the data has not been unintentionally duplicated or excluded.
12. Creating Visualizations from SQL Server Data
Once your connection is established and the correct table is selected, you can create visualizations from the available fields.
Example 1: Sales by Region
- Open a worksheet.
- Drag Region to Columns.
- Drag Sales to Rows.
- Select a bar chart if Tableau has not chosen one automatically.
- Sort the bars to compare regional performance.
- Add labels if useful.
Example 2: Monthly Sales Trend
- Drag OrderDate to Columns.
- Select Month as the date level.
- Drag Sales to Rows.
- Choose a line chart.
- Review the sales trend across months.
Example 3: Profit by Product
- Drag Product to Rows.
- Drag Profit to Columns.
- Choose a bar chart.
- Sort the products by profit.
- Identify products with high or low profit.
13. SQL Server Data Types in Tableau
Verify that Tableau interprets database fields correctly. Data types influence sorting, calculations, filters, and visualization behavior.
| SQL Server Data Type |
Example |
Typical Use |
| INT |
1001 |
Whole-number identifiers and counts |
| DECIMAL |
12500.50 |
Financial values and precise numeric calculations |
| FLOAT |
3.14159 |
Approximate numeric values |
| VARCHAR |
Laptop |
Variable-length text |
| NVARCHAR |
Customer Name |
Unicode text |
| DATE |
2026-01-15 |
Calendar dates |
| DATETIME |
2026-01-15 10:30:00 |
Date and time values |
| BIT |
1 or 0 |
Boolean-style values |
Important: Tableau Desktop does not support the SQL Server TIME data type in the standard SQL Server connector; fields of this type may not appear. Verify connector-specific limitations when designing a data source.
14. Common Connection Errors and Solutions
| Problem |
Possible Cause |
Solution |
| Cannot connect to server |
Incorrect server name, network problem, or unavailable server |
Verify the server address, network access, and server status. |
| Login failed |
Incorrect credentials or insufficient permissions |
Verify the authentication method and request the necessary access. |
| Database not found |
Incorrect database name or missing access |
Check the database name and confirm permissions with the administrator. |
| Driver error |
Required database driver is missing or incorrectly installed |
Follow Tableau's driver download and installation instructions. |
| Connection timeout |
Network latency, firewall restrictions, or server load |
Check network connectivity, firewall rules, and server availability with IT. |
| SSL or certificate error |
Encryption or certificate configuration problem |
Verify the server's encryption requirements and certificate configuration. |
| Table not visible |
Wrong database, schema, or insufficient permissions |
Check the selected database and schema and confirm table permissions. |
| Slow visualization |
Large queries, database workload, or inefficient data model |
Review query performance, filters, selected fields, and the data model. |
| Worksheet unavailable |
Invalid credentials or missing access to the data source |
Edit the connection, verify credentials, and confirm permissions. |
15. Security Best Practices
- Use only authorized database accounts.
- Request the minimum permissions needed for reporting and analysis.
- Follow your organization's encryption and SSL/TLS requirements.
- Never place passwords or other secrets in shared notes or public documents.
- Use read-only access for analytical work when appropriate.
- Follow organizational policies when publishing workbooks and data sources.
- Confirm how credentials are handled before sharing or publishing a workbook.
- Contact the database administrator if access or authentication fails.
16. Best Practices for Tableau-SQL Server Connections
- Use meaningful data source names.
- Select only the tables and fields needed for analysis.
- Choose live connections or extracts based on data freshness and performance requirements.
- Use well-designed SQL queries when Custom SQL is appropriate.
- Check data types before creating calculations and visualizations.
- Validate joins and relationships to avoid duplicate or missing records.
- Use filters carefully and evaluate query performance on large datasets.
- Test the connection before publishing a workbook.
- Coordinate with the database administrator for server, driver, and permission issues.
- Document important connection settings for future maintenance.
17. Practical Exercise: Connect Tableau to SQL Server
Objective: Connect Tableau to a SQL Server database and create basic sales visualizations.
Prerequisites
- Access to a SQL Server instance.
- A database containing sample sales data.
- The server name and authentication details.
- Permission to read the required database tables.
- The required Tableau connector driver, if prompted.
Sample SQL Table
If you have permission to create practice tables in a test database, the following example creates a small Orders table. Do not run table-creation statements against a production database without authorization.
CREATE TABLE dbo.Orders (
OrderID INT PRIMARY KEY,
OrderDate DATE,
Region VARCHAR(50),
Product VARCHAR(100),
Sales DECIMAL(12,2),
Profit DECIMAL(12,2)
);
INSERT INTO dbo.Orders
(OrderID, OrderDate, Region, Product, Sales, Profit)
VALUES
(1001, '2026-01-05', 'West', 'Laptop', 45000, 8000),
(1002, '2026-01-12', 'East', 'Monitor', 18000, 3200),
(1003, '2026-02-03', 'North', 'Keyboard', 5000, 900),
(1004, '2026-02-18', 'South', 'Laptop', 42000, 7500),
(1005, '2026-03-08', 'West', 'Monitor', 20000, 3800);
Exercise Steps
- Open Tableau Desktop.
- Select Microsoft SQL Server under Connect.
- Enter your test server details and sign in.
- Select the database containing the Orders table.
- Drag dbo.Orders onto the data model canvas.
- Verify the data preview and field types.
- Create a bar chart showing Sales by Region.
- Create a line chart showing Sales over time.
- Create a chart comparing Profit by Product.
- Save the workbook and verify that the connection works.
Expected learning: You should be able to connect to SQL Server, select a table, validate the fields, and create visualizations from database data.
18. Interview Questions and Answers
Q1. What is Microsoft SQL Server?
Microsoft SQL Server is a relational database management system used to store, manage, and query structured data.
Q2. How do you connect Tableau to SQL Server?
Select Microsoft SQL Server under Connect, enter the server and authentication details, sign in, select the required database and table, and open a worksheet.
Q3. What information is needed to connect?
Common requirements include the server name, authentication method, credentials when required, and database name. Port and encryption settings may also be needed.
Q4. What is the difference between a live connection and an extract?
A live connection queries the underlying database, while an extract uses a stored snapshot of data that may require refreshing.
Q5. What is Custom SQL?
Custom SQL allows a user to define a SQL query that returns the data needed for analysis, when supported by the connector and connection configuration.
Q6. What is a database schema?
A schema is a logical organization of database objects such as tables and views.
Q7. Why might Tableau fail to connect to SQL Server?
Possible reasons include incorrect server details, invalid credentials, missing permissions, network restrictions, or driver and encryption configuration issues.
Q8. What is a relationship in Tableau?
A relationship connects tables through common fields while preserving their logical table structures.
Q9. What is a join?
A join combines rows from tables based on a matching condition.
Q10. Why should data types be checked?
Correct data types help Tableau interpret dates, text, and numeric fields correctly for analysis and visualization.
19. Quick Revision Checklist
- Understand the purpose of Microsoft SQL Server.
- Know what a Tableau-SQL Server connection does.
- Identify the server name, database name, authentication method, and permissions required.
- Connect through Tableau's Microsoft SQL Server connector.
- Select a database, schema, and table.
- Understand live connections and extracts.
- Know the purpose of SQL queries and Custom SQL.
- Understand relationships and joins.
- Check database field types.
- Troubleshoot common connection errors.
- Follow security and data-access best practices.
- Create basic charts from SQL Server data.
20. Useful Resources
21. Conclusion
Connecting Tableau to Microsoft SQL Server enables analysts to work directly with structured database information and build interactive reports and dashboards. By learning the connection process, authentication requirements, database selection, live connections, extracts, and basic SQL queries, you can create reliable data visualizations for business reporting.
Practice with a test database, confirm that your account has the correct permissions, and verify the data before building dashboards or sharing workbooks.
Explore the course: JustAcademy Tableau Training | Register for a Tableau Course Demo